package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Region;
import cn.wolfcode.wolf2w.domain.Sport;
import cn.wolfcode.wolf2w.domain.Spoteng;
import cn.wolfcode.wolf2w.service.ISportService;
import cn.wolfcode.wolf2w.service.ISpotengService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sport")
public class SpotController {

    @Autowired
    private ISportService sportService;
    @Autowired
    private ISpotengService service;

    @GetMapping("/list")
    public Object list() {
        List<Sport> list = sportService.list();
        return JsonResult.success(list);
    }

    @GetMapping("/dafei")
    public Object dafei(String id) {
        Sport sport = sportService.get(id);
        System.out.println(sport);
        return JsonResult.success(sport);
    }

    @GetMapping("/spot")
    public Object spot(String id) {
        Spoteng spoteng = service.getBySprotiod(id);
        System.out.println(spoteng);
        return JsonResult.success(spoteng);
    }
}
